<%--
  Created by IntelliJ IDEA.
  User: lanou
  Date: 18/1/25
  Time: 下午7:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <meta name="description" content="">
    <meta name="author" content="">


    <title>商城</title>

    <!-- Bootstrap core CSS -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->


    <!-- Custom styles for this template -->
    <link href="offcanvas.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<nav class="navbar navbar-fixed-top navbar-inverse">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
                    aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">Project name</a>
        </div>
        <div id="navbar" class="collapse navbar-collapse">
            <ul class="nav navbar-nav">
                <li class="active"><a href="#">Home</a></li>
                <li><a href="#about">About</a></li>
                <li><a href="#contact">Contact</a></li>
            </ul>
            <span style="color : white" id="yue" class="navbar-right">${money}</span>
            <span style="color : white" class="navbar-right">您的余额：</span>
            <span style="color : white" class="navbar-right">欢迎${uname}</span>
        </div><!-- /.nav-collapse -->
    </div><!-- /.container -->
</nav><!-- /.navbar -->

<div class="container">

    <div class="row row-offcanvas row-offcanvas-right">

        <div class="col-xs-12 col-sm-9">
            <p class="pull-right visible-xs">
                <button type="button" class="btn btn-primary btn-xs" data-toggle="offcanvas">Toggle nav</button>
            </p>
            <div class="jumbotron">
                <h1>我是皮肤!</h1>
                <p>This is an example to show the potential of an offcanvas layout pattern in Bootstrap. Try some
                    responsive-range viewport sizes to see it in action.</p>
            </div>
            <div class="row">
                <c:forEach var="a" items="${ss}">
                    <div class="col-lg-4">
                        <h2>${a.dname}</h2>
                        <img class="img-circle"
                             src="../../img/${a.durl}.jpg"
                             alt="Generic placeholder image" width="140" height="140">
                        <p>${a.djieshao}</p>
                        <p>${a.money}</p>
                        <p><a class="btn btn-default buy" href="#" role="button" did="${a.did}">${a.did}购买&raquo;</a>
                        </p>
                    </div>
                </c:forEach>


            </div><!--/.col-xs-6.col-lg-4-->
        </div><!--/row-->
    </div><!--/.col-xs-12.col-sm-9-->


</div><!--/row-->

<hr>

<footer>
    <p>&copy; Company 2014</p>
</footer>

</div><!--/.container-->


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>


<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->

<script src="offcanvas.js"></script>
<script>
    $(document).ready(function () {
        $(".buy").on("click", function () {
            var id = $(this).attr('did');

            $.ajax({

                type: "post",
                url: "/buy",
                data: {id: id},
                success: function (data) {
                    if (data == 'bbb') {
                        alert("已购买过");
                        location.reload();
                    }

                    if (data=='aaa'){
                        alert("购买成功");
                        location.reload();

                    }

                    if(data=='ccc'){
                        alert("余额不足");
                    }

                },
                error: function (data) {
                    alert("错误了");
                }


            })

        })
    })


</script>
</body>
</html>
